package api

import (
	"feng-che.com/server/driver-quiz/internal"
	"feng-che.com/server/driver-quiz/internal/client"
	"feng-che.com/server/driver-quiz/internal/institution"
	"feng-che.com/server/driver-quiz/internal/services"
	"github.com/gofiber/fiber/v2"
)

func installClientRouter(ClientRoute fiber.Router) {

	ClientRoute.Get("/getAllInstitutions", institution.RequestInstitutionInCache)

	ClientRoute.Post("/wxMpLogin", client.WxMPLogin, client.ResponseClientFound, client.ResponseClientBeCreated)
	//验证登录
	ClientRoute.Use("/", client.VerifyClientForNext)

	ClientRoute.Get("/myExamType", client.LoadClientExamType)
	//上传个人信息
	ClientRoute.Post("/updataInfo", internal.UpdatePersonInfo)
	ClientRoute.Post("/uploadAvatar", internal.ClientUploadAvatar)
	ClientRoute.Get("/getAuthInfo", internal.MiddlewareReadClient, client.ReadAuthInfo)
	ClientRoute.Post("/fillMyInfo", internal.MiddlewareReadClient, client.SetAuthInfo)
	ClientRoute.Post("/setPhoneNumber", internal.MiddlewareReadClient, internal.SetPhoneNumber)
	ClientRoute.Get("/showMyQrcode", client.GenerateClientQrcode)

	// 读取个人预约信息
	ClientRoute.Get("/myReservation", services.ClientReadHeBoughtServices)

	ClientRoute.Get("/cartSimple", internal.ClientQueryCart)
	ClientRoute.Get("/cart", internal.ClientQueryCartFull)

	ClientRoute.Get("/allDriverExamService", internal.ClientGetAllDriverExamModel)
	ClientRoute.Get("/loadOneService", services.MiddlewareFindService, internal.ClientReadOneService)

	ClientRoute.Post("/addDriverExamPracticeServicesToCart", internal.ClientAddDriverExamServiceToCart)
	ClientRoute.Post("/removeDriverExamPracticeServicesToCart", internal.ClientRemoveDriverExamServiceToCart)

	//购买
	ClientRoute.Post("/confirmToBuy", services.MiddlewareFindService, internal.CartToPurchaseOrder)

	//////作为教练读取购买的票
	ClientRoute.Get("/myBuyTicket", internal.ClientQueryHisTickets) // deprecated
	ClientRoute.Get("/myOwnTickets", services.ClientReadHeBoughtServices)
	ClientRoute.Get("/totalOfMyStudent", client.TotalNumberOfCoachSStudent)
	ClientRoute.Get("/getMyStudent", client.CoachReadHisStudents)
	ClientRoute.Post("/addStudent", internal.CoachAddStudent)
	ClientRoute.Post("/coachSentTicketToStudent", internal.CoachSendTicketToHisStudent)
	ClientRoute.Post("/coachRecycleTicket", internal.CoachRecycleTicket)

	ClientRoute.Post("/clientClearCart", internal.ClientClearHisCart)

	//排队

	//扫码使用机器
	ClientRoute.Post("/scanCodeOfMachine", internal.PostRequestParseMiddleWare, internal.MiddlewareReadTicket, internal.MiddlewareReadClient, internal.ScanCodeOfMachine)
	ClientRoute.Get("/showMyScore", internal.ClientQueryStudyScore)
}
